<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>分组捕获</title>
</head>
<body>
<script>
    var str = 'fontFamilyAreYou';
    //驼峰转`_`
    function toUnderline(str){
        return str.replace(/([A-Z])/g,'_$1').toLowerCase()
    }
    //转驼峰
    function toCamelCase(str){
        return str.replace(/_([a-z])/g,(substring, group1) => {
            return group1.toUpperCase()
        })
    }
    var _underline = toUnderline(str);
    console.log(_underline)
    var camelCase = toCamelCase(_underline);
    console.log(camelCase)
</script>
</body>
</html>
